SLDMagic | An Improved Magic Set Technique
نویسنده
چکیده
We present a rewriting method for Datalog-programs which simulates SLD-resolution more closely than the ordinary \magic set" method does. This is especially advantageous in the case of tail-recursive programs, but already in non-recursive programs we can often save a number of joins. In contrast to the method of Ross 7], we do not only solve the problem of tail-recursion, but try to simulate SLD-resolution as fully as possible. Based on an idea of Bry 3], our method can be described in an elegant way by means of a meta-interpreter. An especially nice feature of our approach is that we get many other known optimizations \for free" when we simulate SLD-resolution in this way. In contrast to our earlier method 2], we can now handle the full range from a direct simulation of SLD-resolution to the standard \magic set" technique (selectable by annotations within the program). We compare the eeciency of SLD-resolution and magic sets within a common framework, explain their main diierences, and give hints for choosing between them.
منابع مشابه
A Variant of Earley Deduction with Partial Evaluation
We present an algorithm for query evaluation given a logic program consisting of function-free Datalog rules. It is based on Earley Deduction [4,6] and uses a partial evaluation similar to the one we developed for our SLDMagic method [1]. With this, finite automata modeling the evaluation of given queries are generated. In certain cases, the new method is more efficient than SLDMagic and the st...
متن کاملA Framework for Goal-Directed Query Evaluation with Negation
This paper contains a proposal how goal-directed query evaluation for the well-founded semantics WFS (and other negation semantics) can be done based on elementary program transformations. It also gives a new look at the author’s SLDMagic method, which has several advantages over the standard magic set method (e.g., for tail recursions).
متن کاملImplementation Alternatives for Bottom-Up Evaluation
Bottom-up evaluation is a central part of query evaluation / program execution in deductive databases. It is used after a source code optimization like magic sets or SLDmagic that ensures that only facts relevant for the query can be derived. Then bottomup evaluation simply performs the iteration of the standard TP -operator to compute the minimal model. However, there are different ways to imp...
متن کاملA Reed–Solomon Code Magic Trick
Richard Ehrenborg [1] has provided a nice magic trick that can be used to illustrate many properties of Hamming codes. His paper includes a set of manipulatives that can be used to implement the trick. An improved version of this Hamming code magic trick is described in a recent paper in Math Horizons [3]. In this paper, we introduce a similar magic trick that is based on a Reed–Solomon code. I...
متن کاملEnhancing the Magic-Set Method for Disjunctive Datalog Programs
We present a new technique for the optimization of (partially) bound queries over disjunctive datalog programs. The technique exploits the propagation of query bindings, and extends the Magic-Set optimization technique (originally defined for non-disjunctive programs) to the disjunctive case, substantially improving on previously defined approaches. Magic-Set-transformed disjunctive programs fr...
متن کامل